<!--
/**************************************************
* @ Affichemanage.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/05/24, owen
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<%
	ResultProcess tAffichelist = (ResultProcess)request.getAttribute("affichelist");
	ArrayList tList = new ArrayList();
	String [] tStr = null;
	String tReQuery = (String)request.getAttribute("requery");
	
%>
<HTML>
	<HEAD>
		<TITLE>公告管理</TITLE>
		<META http-equiv=Content-Type content="text/html; charset=UTF-8">
        <LINK href="<%=root%>/css/caigouxitong.css"" type=text/css rel=stylesheet>
        <SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
        <SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
       <SCRIPT language=javascript src="<%=root%>/framework/js/datePicker/WdatePicker.js"></SCRIPT>
	    <script language="javascript">
           function process(){
             var tStr = "";		
			 var tEnd = "";				
			 if(!isEmpty(afficheform.gs_start_date.value)){
				tStr = afficheform.gs_start_date.value.substr(0,4) + afficheform.gs_start_date.value.substr(5,2) + afficheform.gs_start_date.value.substr(8,2);
			 }
			 if(!isEmpty(afficheform.gs_end_date.value)){
				tEnd = afficheform.gs_end_date.value.substr(0,4) + afficheform.gs_end_date.value.substr(5,2) + afficheform.gs_end_date.value.substr(8,2);						
			 }
			 if(parseInt(tStr) > parseInt(tEnd)){
					alert("发布日期的最晚日期不可大于最早日期！");
					return false;
			 }		
						
			 afficheform.action = "<%= response.encodeURL(request.getContextPath() + "/A400902.do") %>";
			 afficheform.submit();
           }
           
            function processT(){
              <%
                if(tAffichelist != null){ 
			  %>			  	  
			  	  parent.document.frames["topFrame"].window.document.all('affmrkinf').src = "<%=response.encodeURL(root+"/affimark.jsp")%>";
			  <%}%>
              <%
				if(tReQuery!=null && tReQuery.equals("true")){
			  %>							
				  afficheform.action = "<%= response.encodeURL(request.getContextPath() + "/A400902.do") %>";
			      afficheform.submit();
			  <%}%>
			}
                   
           function add(){
             var result = null;	
		     //result = window.showModalDialog("<%= response.encodeURL(request.getContextPath() + "/A400903.do") %>", window,"status:no;unadorned:no;dialogWidth:900px;dialogHeight:600px;help:no;");		     
		     result = window.open("<%= response.encodeURL(request.getContextPath() + "/A400903.do") %>", 'affnewwindow',"toolbar=no, menubar=no,scrollbars=no,location=no, status=no, resizable=yes,height=500, width=780, top=5%, left=15%, help=no");		     
		     if(result != null){
		     	 //alert("新增公告信息成功!");                
				 //process();	
        	 }
             return true;
           }
           
           function down(temp){
            //var name=document.pager.filename.value; 
            //alert(temp);
			var url = '<%=response.encodeURL(root+"/A400906.do")%>?filename='+temp;
		    window.open(url,null," edge: sunken ,center: Yes, help: No, resizable: Yes, status: No,width=280px,height=220px, scrollbars=yes");
		     }
		     
		   function mod(temp){
            var result = null;	
            
		    result = window.open('<%= response.encodeURL(request.getContextPath() + "/A400907.do") %>?id='+temp, 'affmodwindow', "toolbar=no, menubar=no,scrollbars=no,location=no, status=no, resizable=yes,height=500, width=780, top=5%, left=15%, help=no");
		   
		     if(result != null){
                 //alert("修改公告信息成功!");
				 //process();	
        	}
            return true;
          }  
          
          function del(temp){
             if (confirm('是否删除此公告？')) 
             {
                 delform.id.value=temp;
                 delform.gs_affiche_title.value=afficheform.gs_affiche_title.value;
                 delform.gs_affiche_content.value=afficheform.gs_affiche_content.value;
                 delform.gs_start_date.value=afficheform.gs_start_date.value;
                 delform.gs_end_date.value=afficheform.gs_end_date.value;
                 
                 
                 delform.action = "<%= response.encodeURL(request.getContextPath() + "/A400910.do") %>";
			     delform.submit();
             }
          }
          
          function clean(){
             afficheform.gs_affiche_title.value="";
             afficheform.gs_affiche_content.value="";
             afficheform.gs_start_date.value="";
             afficheform.gs_end_date.value="";
          }
			</script>
	</HEAD>
	<body BGCOLOR="#f2f2f2" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0" onload="processT()">
		<p><br>
		</p>
		<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
			<tr>
				<td height="20">
					<table width="100%" border="0" cellspacing="0" cellpadding="1">
						<tr height="20">
							<td height="30" width="758" class="mtxt_black">公告管理&nbsp;
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td class="bg_line" height="2"></td>
			</tr>
		</table>
		<br>
		<form name=afficheform method="get">
		<table class="bg_table" id="Table1" cellspacing="1" cellpadding="0" width="98%" align="center" border="0">
			<tr>
				<TD class="bg_column" align="center" width="20%">公告标题</TD>
				<TD align="left" class="bg_row_odd">
					<INPUT type="text" name="gs_affiche_title" value="<%=request.getParameter("gs_affiche_title")==null? "":request.getParameter("gs_affiche_title") %>">
				</TD>
				<TD class="bg_column" align="center" width="20%">公告内容</TD>
				<TD align="left" class="bg_row_odd">
					<INPUT type="text" name="gs_affiche_content" value="<%=request.getParameter("gs_affiche_content")==null? "":request.getParameter("gs_affiche_content") %>">
				</TD>
			</tr>
			<tr>
				<TD class="bg_column" align="center" width="20%">发布日期</TD>
				<TD align="left" class="bg_row_odd" colspan="3">
				<%=framework.custom.UIManager.generateDateInput("gs_start_date",
							request.getParameter("gs_start_date")==null?"":request.getParameter("gs_start_date"))%>
					
					至
				<%=framework.custom.UIManager.generateDateInput("gs_end_date",
							request.getParameter("gs_end_date")==null?"":request.getParameter("gs_end_date"))%>
				</TD>
			</tr>
		</table>
        <%if(tAffichelist != null){
                    int totalRecords = 0;
                    int defaultPageSize = 10;
                    totalRecords = tAffichelist.getRecordsSize();
            %>  
            <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'>
            <%tList = tAffichelist.getDisplayRecords(index.intValue(),pageSize.intValue()); %>
            </page:pager>
            <%} %>
		</form>
		<p align="center">
		    <INPUT type="button" value="查询" class="kuang" name="button1" onclick="return process();">
			<INPUT type="button" value="清空" class="kuang" name="Button1" onclick="return clean();">
		</p>

 <%
	              if(tAffichelist != null){
 %>		
		<form name="pager">
		<table class="bg_table" id="tableId" cellspacing="1" cellpadding="2" width="98%" align="center"
			border="0">
			<tr class="bg_column" height="20">
				<td class="top" align="center" width="5%">
				</td>
				<td class="top" align="center" width="5%">
				</td>
				<td class="top" align="center">
					<div align="center" class="txt_content">公告标题</div>
				</td>
				<td class="top" align="center" width="20%">
					<div align="center" class="txt_content">发布日期</div>
				</td>
				<td class="top" align="center">
					<div align="center" class="txt_content">相关附件</div>
				</td>
				<td class="top" align="center" width="10%">
					<div align="center" class="txt_content">详细信息</div>
				</td>
			</tr>
			 <%
						 if(tList != null && tList.size() > 0){
					    	for(int i=0; i<tList.size(); i++){
						       tStr = (String[])tList.get(i);
						       String tTempStr="";
						       if(i%2==0){
						     	 tTempStr="class=\"bg_row_odd\"";
						        }else {
							     tTempStr="class=\"bg_row_even\"";
							}
			%>
			
			<tr <%=tTempStr%> height="20">
				<td class="top" align="center">
					<INPUT type="button" value="修改" class="kuang" onclick="mod('<%=tStr[0] %>')">
				</td>
				<td class="top" align="center">
					<INPUT type="button" value="删除" class="kuang" onclick="del('<%=tStr[0] %>')">
				</td>
				<td class="top" align="center">
					<div align="center" class="txt_content">
						<a href="<%= response.encodeURL(request.getContextPath() + "/A400909.do") %>?id=<%=tStr[0] %>" target="_blank"><%=tStr[1] %></a>
					</div>
				</td>
				<td class="top" align="center">
					<div align="center" class="txt_content">
						<%=tStr[3] %>
					</div>
				<td class="top" align="center">
					<div align="center" class="txt_content">
					   <a href="#" onclick="down('<%=tStr[0] %>')"><%=tStr[2] %></a>
					    
					</div>
				</td>
				<td class="top" align="center">
					<div align="center" class="txt_content">
						<a href="<%= response.encodeURL(request.getContextPath() + "/A400909.do") %>?id=<%=tStr[0] %>" target="_blank">详细</a>
			
					</div>
				</td>
			</tr>
			 <%
						}
			%>
			<tr class="bg_column" height="20">
				<td width="960" height="16" colspan="7" align="right">
					<!--导航条-->
					<page:navigator type='text' queryForm="afficheform"/>
				</td>
			</tr>
			<%
						}else{
		    %>
							<font color="red">没有符合条件的公告信息</font>
		   <%
						}
		   %>
		</table>
		</form>
		<p align="center">
			<INPUT type="button" value="增加" class="kuang" name="button4" onclick="return add();">
		</p>
		<%} %>
	 <form action="" name="addform" method="post" ENCTYPE="multipart/form-data">
	 <div style='display:none'>
	  <input type="file" name="filename" size="100">
      <input type=hidden name="gs_affiche_title">	
      <input type="hidden" name="gs_affiche_date">	
      <input type="hidden" name="gs_affiche_content">	
      </div>
     </form>
     
     <form action="" name="delform" method="post">
	  <input type="hidden" name="id">	
	  <input type="hidden" name="gs_affiche_title">	
	  <input type="hidden" name="gs_affiche_content">	
	  <input type="hidden" name="gs_start_date">	
	  <input type="hidden" name="gs_end_date">	
     </form>
	</body>
</HTML>
